package Oct_2020.part8;

import org.junit.Test;

import java.io.File;
import java.io.IOException;

public class etcd {
    public static void main(String[] args) {

    }

    @Test
    public void zce() throws IOException {
        File file=new File("C:\\Users\\tarena\\Desktop\\zce.txt");
        System.out.println(file.length());
        System.out.println(file.isFile());
        System.out.println(file.exists());
        System.out.println(file.getName());
        System.out.println(file.isDirectory());
        System.out.println(file.getParent());
        System.out.println(file.getAbsolutePath());
        System.out.println(file.delete());
        System.out.println(file.createNewFile());
        file=new File("C:\\Users\\tarena\\Desktop\\top\\lu");
        file.mkdirs();
//        file.delete();//只能删除空的文件夹
        System.out.println( file.list());
        file.listFiles();

        File[] p=file.listFiles();
        for (File m:
             p) {
            if (true==m.isFile())
            System.out.println(m.length());
            else if (true==m.isDirectory()){
                System.out.println(m.getName());
            }
        }


    }
}